Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
MongoDB/node.js - ¿Cómo encontrar todas las películas del mismo género por "Nombre"?

Estoy construyendo una aplicación de estilo 'netflix' para practicar. En él, quiero que el usuario pueda encontrar todas las películas de un determinado género escribiendo la siguiente url:

http://localhost:8080/movies/Aventura

Pero parece que me estoy equivocando en alguna parte, porque la lista devuelve nulo... aquí está mi código:

 app.get('/movies/:genre', (req, res) => { Movies.find({ Genre: { Name: req.params.genre } }).populate('Genre Director Actors') .then((movie) => { res.json(movie); }).catch((err) => { console.error(err); res.status(500).send('Error: ' + err); }); });

y estos son los datos de MongoDB:

 "Genre": [ { "_id": "611b4b465bf9b8645dd32ef9", "Name": "Animated", "Description": "Animation is a method in which pictures are manipulated to appear as moving images. In traditional animation, images are drawn or painted by hand on transparent celluloid sheets to be photographed and exhibited on film." } ], "Actors": [ { "_id": "611bd09659f7b8323ad90441", "Name": "Johnny Depp", "Bio": "John Christopher Depp II is an American actor, producer, and musician. He is the recipient of various accolades, including a Golden Globe Award and a Screen Actors Guild Award, in addition to nominations for three Academy Awards and two British Academy Film Awards.", "Birth": "1963-06-09", "Death": "N/A" } ], "_id": "611c06f4cb359ae2b8220245", "Title": "Rango", "Description": "A chameleon (Johnny Depp) who has lived as a sheltered family pet finds himself in the grip of an identity crisis. Rango wonders how to stand out when it is his nature to blend in. When he accidentally winds up in a frontier town called Dirt, he takes the first step on a transformational journey as the town's new sheriff. Though at first Rango only role-plays, a series of thrilling situations and outrageous encounters forces him to become a real hero.", "Director": { "_id": "611b4f835bf9b8645dd32efe", "Name": "Gore Verbinski", "Bio": "Gregor Justin 'Gore' Verbinski is an American film director, screenwriter, producer, and musician. He is best known for directing The Ring, the Pirates of the Caribbean films, and Rango.", "Birth": "1964-03-16", "Death": "N/A" }, "ImagePath": "rango.png", "Featured": false }

¡Toda ayuda es apreciada!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Movies.find({ "Genre.Name": req.params.genre })
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda